<?php

	eb_include_class("EbTableSQLModel");

	class ObjectMetaDataModel extends EbTableSQLModel
	{
		public function __construct()
		{
			parent::init('eb_metadata',null,'meta_id');
		}
		
		public function getColumns()
		{
			return array(
				new EbTableColumn('meta_id','int',true,1,true),
				new EbTableColumn('ob_id','int',true,EB_INDEX_KEY),
				new EbTableColumn('name','varchar(32)'),
				new EbTableColumn('data','text',false)
			);
		}
		
		public function selectByObject($ob_id = 0)
		{
			$metas = $this->selectByob_id($ob_id);
			$buffer = array();
			
			foreach ($metas AS $meta)
			{
				$buffer[$meta->name] = $meta->data;
			}
			
			return $buffer;
		}
	}